<?php

class Bemigo_IndexController extends Bemigo_Controller_Action_Base
{

	public function init()
	{
		parent::init();
	}

	public function indexAction()
	{
		$this->view->logged_in = $this->isLoggedIn();
		$this->view->fb_app_id = Zend_Registry::get("configuration")->facebook->app->id;
	}

	public function logoutAction(){
		if($this->isLoggedIn()){
			$user_id = $this->_facebook->getUser();
			$manager = $this->getFrontController()->getParam('bootstrap')->getResource('cachemanager');
			$cache = $manager->getCache('bemigo');
			$cache->remove("friends_".$user_id);
			$cache->remove("profile_".$user_id);

			$this->_redirect($this->_facebook->getLogoutUrl());
			return;
		}
		$this->_redirect("/index");
	}

}

